JBuilder 3.5 Hints and Tips

This document contains a subset of known problems, workarounds and tips for JBuilder 3.5 Foundation, Professional and Enterprise Editions. Therefore, some items mentioned may or may not apply to your edition.

For the latest information on JBuilder, please see the JBuilder 3.5 section at: http://www.borland.com/jbuilder/.

The online Help is the most complete and current version of the product documentation. To display the online Help, choose Help | Help Topics. See the JBuilder technical publications page at: http://www.borland.com/techpubs/jbuilder and select the appropriate link for updated documentation.


Table of Contents

General
Install
Editor
Components
Debugger
Designer
Database and JDataStore
Wizards
Compiler / Build System
Runtime
VisiBroker
Inprise Application Server Integration
Samples
Performance
JDBC Drivers
International


General

What's new in JBuilder version 3.5

JBuilder 3.5 is written completely in Java. It uses the Swing component library, provided by JavaSoft (Sun Microsystems), as its foundation. This pure Java component library allows JBuilder to have a complex UI and remain 100% Java. The Swing library also gives the added benefit of a pluggable look and feel which allows JBuilder to adjust its appearance to match the computer's native operating system UI without sacrificing the power and flexibility of the JBuilder UI.

Additional features in this release include:

Printing support
Enhanced JDK support
CVS Sample for team development
Improved install and launch

For more information on new features in JBuilder 3.5, see "What's New in JBuilder 3.5" in the online "Quick Start".

Configuring JBuilder 3.5

The batch and shell files formerly used to launch JBuilder have been replaced by a new config file format that is the same for all platforms.  Among other things, a config file can:
    - Pass parameters to the Java VM
    - Add entries to the Java boot path and Java classpath
    - Describe the location of the java executable
    - Specify the application class to be run.
JBuilder.config is processed when JBuilder 3.5 is launched. You may need to edit it to modify the Java classpath or pass parameters to the VM.  If you do, keep a copy of the original JBuilder.config, just in case.

Enhanced stability and performance

JBuilder 3.5 is faster and more reliable than ever.

Improved Windows integration

Interface is more seamless, and installation is much easier. Common Windows features, such addition to the Start Menu, are now part of the installation process.

For a complete list of JBuilder 3.5 features, see the JBuilder web site at http://www.borland.com/jbuilder

The QuickStart topic in the online help is a good place to get info on what else is new in JBuilder 3.5.


JBuilder 3.5 is available on multiple platforms. For consistency, JBuilder 3.5 documentation and screen shots are based on the Solaris platform. See the table below for a description of platform conventions and directories.

Platform conventions and directories

Item

Meaning

Paths All paths in the documentation are indicated with a forward slash (/).
For the Windows platform, use a backslash (\).
Home directory

The location of the home directory varies by platform. JBuilder 3.5 documentation is based on the Solaris platform.

  • For Solaris and Linux, the home directory can vary. For example, it could be /user/[username] or /home/[username].
  • For Windows 95/98, the home directory is C:\Windows.
  • For Windows NT, the home directory is C:\Winnt\Profiles\[username] .
.jbuilder directory The .jbuilder directory, where JBuilder 3.5 settings are stored, is located in the home directory.
jbproject directory The jbproject directory, which contains project, class, and source files, is located in the home directory. JBuilder 3.5 saves files to this default path.
Screen shots Screen shots reflect the Java Metal look and feel on the Solaris platform.

[top]


Install

Tips:

For explicit install instructions, look at setup_<platform>.html. It is very important to follow those directions.

Linux

Possible Problem: System minimum configuration meets or exceeds specified requirements, but JBuilder runs slow.

Solution: The Linux kernel has problems with a few motherboard/BIOS not reporting total memory available. To check that all installed memory is being recognized, type the following at a shell prompt:
cat /proc/meminfo
the output will include a line looking like:

MemTotal: ######## kB
where "########" should equal the amount of memory your computer has. If it doesn't, you'll need to explicitly tell the kernel by editing the file /etc/lilo.conf.

Details for doing this can be found at:
http://www.redhat.com/support/docs/faqs/rhl_general_faq/FAQ-7.html

J2EE

There are features in JBuilder 3.5 -- Enterprise edition to support Java 2 Enterprise Edition (J2EE) functionality.  To enable these features (e.g, Enterprise JavaBeans support), you must install the J2EE libraries. J2EE can be downloaded from Sun's web site at:

http://java.sun.com/j2ee

Once J2EE has been downloaded and installed locally, edit the jbuilder.config and add the j2ee.jar to the classpath. This will enable the J2EE files to be found by JBuilder 3.5, which will enable the Enterprise features that use J2EE.  You will also need to create a library for J2EE in JBuilder 3.5 so these classes will become available to your project(s).

Known problems:

[top]


Editor

There are many changes in the editor, including Emacs support, code templates and an improved Code Insight. 

Code Insight improvements:

The ability to "drill down" and open a class that's being used in the content (main editor) pane is still there but instead of working via alt + mouse click, it is used by moving the caret to the class and selecting with a Ctrl + Enter. Other ways of engaging this functionality are to right click on the method/class you want to drill into and select Browse Symbol, Ctrl + mouse click on the method in the structure pane, or to look at an unused class use the "Browse symbol" menu choice from the Search menu.

There are additional adjustments available to code insights from the Tools | IDE Options menu, including user selectable keystrokes.

Code Templates are now available from the content pane via Ctrl+J, the templates are commonly used programming blocks (try/catch, if/else, switch).

Known problems:

[top]


Components

Editing date values:

To help prevent unexpected results when date values are edited, dbSwing and JBCL components convert the default pattern's two-digit year to a four-digit year. dbSwing's JdbTextField and JdbTable also substitute a four-digit year when a custom displayMask is used to control editing (but not when you specify an editMask, because then it controls editing). JdbTextField does this conversion when a date or timestamp is displayed; the other components wait until the date or timestamp is edited. The pattern used to parse edited values is not changed.

To understand the reason for this, you must be aware of Java's default behavior when parsing a date value using a pattern that specifies a two-digit year. If the date string contains a two-digit year, the year is assumed to fall in a window that runs from 80 years before the current date to 20 years in the future; otherwise (that is, the year is one, three, or four digits long), the year is taken just as it is. To see the implications of this rule, consider an example:

This character string is parsed: "9/23/2085"

The value in the resulting date object is: September 23, 2085

With the default formatting, this is displayed as: "9/23/85"

The string is edited: "10/23/85"

Parsing it gives this value in a date object: October 23, 1985

Only the month was edited, but the century also changed.

Forcing the full four-digit year to be displayed prevents this behavior. When entering a new value, you can still enter a two-digit year and let Java determine whether it's in the 20th or 21st century, or you can specify the century yourself by entering all four digits. One warning: always represent a year between 2000 and 2009 as a two-digit string with a leading zero. As the rule above states, a one-digit year is not treated as falling somewhere in the 20th or 21st century.

[top]


Debugger

Tips:

Debugging the generated source of a JSP page (Enterprise Edition only):

When a web server is asked for a URL that contains a JSP page. the page is compiled into a java servlet. It's the output from the servlet that is seen on the browser. To debug this generated servlet take the following steps.

  1. Create a new project and use the JSP Wizard to create a new JSP.
  2. In the project properties dialog. Select the Run tab and then select the JSP/SHTML tab.   Enable the keep generated check box.
  3. Right click on the .jsp file and select run. This forces the page to be compiled and creates the source code to the servlet.
  4. Stop the running web server by clicking the square stop button.
  5. Select 'Add file to project'. In your project directory, there will be a directory called 'work'.  Below that there is a directory containing the generated servlet. Add this java file to the project.
  6. Set a break point and debug.

Known problems:

[top]


Designer

Tips:

"Red Beans"

If you see one of your components as a red box with its class name at the top, JBuilder has not been able to create an instance of that  component  for the designer. This is called a "Red Bean". Some reasons you  might see a  Red Bean are:

  1. The class or its constructor is not public
  2. The class threw exceptions on every constructor JBuilder tried
  3. The class is the 'this' object and it extends an abstract class

Items (1) and (2) can be fixed by supplying a proper default constructor or subclassing that class in order to provide a default constructor.  Item (3) is more complex. Whenever JBuilder needs to instantiate an object to be the 'this' object, it encounters a paradox. It cannot instantiate the  object  you are designing. To circumvent this problem, JBuilder always attempts to  instantiate the superclass of the "this" object. If the superclass is abstract, it cannot be instantiated. Here is the solution:

In the file .jbuilder/user.properties, you will find a line that looks like:

designer;proxy.java.awt.Component=com.borland.jbuilder.designer.dt.ComponentProxy

This line says that whenever you are forced to instantiate com.sun.java.swing.JComponent (which is abstract), you will find an  acceptable   concrete proxy class for it in:

com.borland.jbuilder.dt.JComponentProxy.

You may add your own proxy objects using this pattern. The proxy class does not need to do anything other than the following:

  1. Extend the abstract class in question.
  2. Be concrete (not be declared abstract itself).
  3. Be public (both the class and its constructor).

Known problems:

[top]


Database and JDataStore

The startup scripts for datastore explorer (dse) and datastore server (dss) in the jbuilder35/bin directory, on Linux, install without the executable permisions set. To launch these scripts, set the executable permissions with: chmod 755 dse (or dss) or by right clicking on the icon for the file in the file manager, selecting Properties from drop down and adding Exec permission from the dialog.

Some of the .jar files are labeled 3.1. This is as designed.

A new sample, WebBench, demonstrates JDataStore use and lets you experiment with JDataStore performance tuning. The sample contains several small errors that prevent compilation. To fix them:

In file AppProperties.java: remove the import for com.borland.datastore.cons.

In file OptionsDialog.java: remove the import for com.borland.datastore.cons and change "DataStoreConst.MIN_CACHE_SIZE" in line 262 to "48".

Before creating a store, and in order to place it at the right location, select Bench | Options... and click the OK Button.

A LOCK command has been added to the SQL dialect supported by JDataStore's JDBC driver. By locking all the tables a transaction needs at the start of a transaction, you can ensure that it will not deadlock with another transaction that tries to access the same tables in a different sequence. The syntax is:

LOCK <table reference list>

where "<table reference list> is a comma-separated list of table references.


Application Deployment

Information on deploying the JDataStore JDBC server for remote access is described in "Deploying the DataStore JDBC server" in the JDataStore Programmer's Guide. Tips for reducing the deployed size of JDataStore client applications can be found in "Pruning deployed resources" in the JDataStore Programmer's Guide.

Reminder: JDataStore is provided with a license for development only. To deploy JDataStore and DataExpress libraries with your application, a deployment license must be purchased. For more information on purchasing a JDataStore deployment license, see http://www.borland.com/jdatastore/

Only the following JDataStore Libraries may be deployed with your application when you purchase a JDataStore deployment license:

dx3.1.jar

datastore3.1.jar

dsserver3.1.jar

dsremote3.1.jar

Known problems:

[top]


Wizards

Known problems:

[top]


Compiler / Build System

Known problems:

[top]


Runtime

Running JDK 1.1x Applets

To run JDK 1.1x Applets in JBuilder Professional or JBuilder Enterprise, you need to download the JDK 1.1x specific version of JFC (Swing) from JavaSoft. Once you have downloaded the classes, create a library for them and add the library to the project. This will allow the Applet runner, which uses JFC, to launch.

Known Problems:

Running JDK 1.2 Applets

In order to run an Applet on Solaris or Linux from within JBuilder you must add the Open Tools SDK library to your project. Failing to add this library can lead to an exception about a NoClassDefFoundError:AppletTestbed. This problem currently affects some of the applet samples, including the Primes Swing sample.

[top]


VisiBroker

Known Problems:

[top]


Inprise Application Server Integration

To enable Inprise Application Server Integration invoke "IAS Setup.." from the JBuilder Tools menu and follow the instructions in the dialog. The following features of Inprise Application Server are available from within JBuilder:

EJB Deployment Descriptor Editor for 'ejb-jar.xml' JBuilder nodes.

EJB Deployment Wizard added to JBuilder Tools menu.

See the Inprise Application Server FAQ at:

http://www.borland.com/devsupport/appserver/faq/

for more information.

[top]


Samples

The Multilingual sample (IntlDemo) will not compile unless you edit the file, AppDataModule.java, found in <jbuilder35>\samples\dbswing\MultiLingual\src\
com\borland\samples\dbswing\multilingual\application\

and place the line below, at the top of the file:

    package com.borland.samples.dbswing.multilingual.application;

Then compile the project.[81120]

The OnlineStore sample requires the use of platform-specific InterBase database (.gdb) files in the 'OnlineStore/database' subdirectory. Database files are provided for the Windows, Solaris, and Linux platforms. Before running the OnlineStore sample, you will need to copy both of the platform-specific acmecb and cliffhanger databases to filenames with the normal .gdb file extension. For example, to run the sample on Windows, copy 'acmecb.gdb.windows' to 'acmecb.gdb' and 'cliffhanger.gdb.windows' to 'cliffhanger.gdb'.

The Samples.html file should be viewed in the JBuilder AppBrowser or from the link in the Welcome Project.

Known Problems:

[top]


Performance

These are some suggestions for improving local performance of JBuilder 3.5.


JDBC Drivers

The editor for a Database object's connection property displays a list of common JDBC drivers. These drivers are not necessarily installed on your machine; conversely, you may have drivers that are not in the list. After you have installed a driver, follow these instruction to make it available to JBuilder projects in both design and run.

Design: JBuilder uses the java CLASSPATH to find class files. To add a jar file to the CLASSPATH, modify the JBuilder.config file. This enables the JBuilder UI designer to show live data obtained through the driver.Use one of the following commands in the JBuilder.config file:

addjars <path> - Adds all JAR files in the specified directory to the path

addpath <path> - Adds a specific JAR file to the Java classpath.

These statements must use forward slashes and can be either relative or absolute. Here are two Unix examples:

addjars ../../usr/interclient/

addpath ../usr/interclient/interclient.jar

and two Windows examples:

addjars c:/interclient/

addpath c:/interclient/interclient.jar

Runtime: A project run from within JBuilder uses only the classpath defined for that project. To add your driver to a project's classpath, you must define a library for it and use the library in your project. These steps go a little further, defining the new library as a default so it is automatically added to all new projects:

1.Start JBuilder and close any open projects.

2.Choose Project|Default Project Properties.

3.Select the Required Libraries tab on the Paths page, then click the Add button.

4.Click New to define a new library.

5.Type a name, for example "InterClient", in the Name field.

6.Select the Class tab, then click Add

7.If the JDBC driver is in a ZIP or JAR, browse to it and click OK. If the classes are not zipped, browse to the directory that contains them and click OK. You can repeat this step to select files from different locations.

8.Click OK on each of the opened dialog boxes to close them.

If you plan to run JDBC Explorer outside of JBuilder, add your driver's jar or class files to jdbce.config, in the bin directory under your JBuilder install directory. Use the same addpath and addjars statements that you use in JBuilder.config. A comment in jdbce.config tells where to put them.

[top]


International

Installing to a Japanese NEC machine

[75607] If you are installing JBuilder to a Japanese NEC machine and the install program causes an operating system error message saying that "Drive C: is not ready... the drive door may be open...", then you should press the <Ignore> button in this dialog. Install will then complete normally. (The <Abort> button should also work.)

Japanese Fonts on Linux

[74990][75704][75705] If you experience problems displaying Japanese fonts on Linux, you may need to update the file, <jdk1.2.2>/jre/lib/font.properties.ja. JavaSoft's web site has instructions on how to do this in Japanese: Directions to modify the font.properties file (in Japanese).

Editor Patch for Unix Platforms -- libawt.so

The following problem can be worked around by applying the Patch described immediately afterwards. Note, these instructions apply only to Solaris. Linux users can check for any updated information and patches on the JBuilder Newsgroups and at the Borland Community site.

[70036][70507] With the setting, "Enable international input methods" turned on (found under Tools | IDE Options; <Editor>; <Smart key options>), Editor actions associated with Ctrl-Shift keys do not get executed.

This section describes application of the libawt.so patch for Solaris, which addresses the problems mentioned above.


Unix & Enterprise Edn. Patch -- AwtMotifPatch.jar (Solaris & Linux), DBCSpatch.jar (JBuilder Enterprise Edition, all platforms)

The following problems can be worked around by applying the Patch described immediately afterwards.

Take the following steps to apply this patch.

    Linux users:
    The files, <path_to_JBuilder>/lib/intl/AwtMotifPatch.jar & DBCSpatch.jar, are for Solaris only. Linux users can check for updated information and patches in the JBuilder Newsgroups and at the Borland Community site.
    Solaris users:
  1. Make a back up of the configuration file, <path_to_JBuilder>/bin/jdk.config
  2. Now use your favorite editor to open this file, <path_to_JBuilder>/bin/jdk.config
  3. Find the following line and uncomment it:
    addbootpath=../lib/intl/DBCSpatch.jar:../lib/intl/AwtMotifpatch.jar
  4. The 'p' in "AwtMotifpatch.jar" should be upper case. Change the character so that the word appears as "...AwtMotifPatch.jar"
    MS Windows users:
  1. Make a back up of the configuration file, <path_to_JBuilder>/bin/jdk.config
  2. Now use your favorite editor to open this file, <path_to_JBuilder>/bin/jdk.config
  3. Find the following line and uncomment it (Note, unlike the above environment(s), MS Windows does not need AwtMotifPatch.jar):
    addbootpath=../lib/intl/DBCSpatch.jar

Command Line Compiler

[79877] (MS Windows platform only) European versions of the command line compilers (bcj and bmj) may display accented characters incorrectly in a console window. The workaround is to invoke the compiler as follows (Note, <path_to_JBuilder>/lib/jbuilder.jar must be on your classpath):

    java -Dfile.encoding=Cp850 com.borland.compiler.frontend.Main -encoding Cp1252 myFile.java

The first encoding option above is passed to the Virtual Machine and the second encoding option is passed to the compiler. Please note that this example assumes Code Page 850 is used in the console window (as shown by the chcp command), and that your java files are encoded in Code Page 1252 (which is the case when a Windows based editor was used, rather than an "old style" DOS based editor).

If your program sends accented characters to the console window, they will be displayed correctly if you use the following (assuming your console window uses Code Page 850, as shown by the DOS chcp command):

    java -Dfile.encoding=Cp850 myClassFile

Other Known Problems:

[top]